%source_path = '/home/wzhu/Documents/CarAoT/testPrepData';
%out_file_name = '/home/wzhu/Documents/CarAoT/testCode/detection/img_file_list.txt';

source_path = '../../prepFEIFEIData';
disp(source_path);
train_file_name = '../detection/train_pos_file_list.txt';
test_file_name = '../detection/test_pos_file_list.txt';
%source_path = 'D:/Projects/AoT/ReweightData';
%out_file_name = '../detection/train_neg_file_list.txt';


file_list = dir([source_path '/*_maps.mat']);
n_file = length(file_list);



train_split = 0:6;
test_split = 7:9;


p_file= fopen(train_file_name,'w');
fprintf(p_file,'%d\n',48*length(train_split));
for i_split = 1:length(train_split)
   off_set = train_split(i_split)*48;
for i_file = 1:48
    end_ind = strfind(file_list(off_set+i_file).name,'_maps.mat');
    out_string = [source_path '/' file_list(off_set+i_file).name(1:end_ind-1)];
    fprintf(p_file,'%s\n',out_string);
end
end
fclose(p_file);


p_file= fopen(test_file_name,'w');
fprintf(p_file,'%d\n',48*length(test_split));
for i_split = 1:length(test_split)
   off_set = test_split(i_split)*48;
for i_file = 1:48
    end_ind = strfind(file_list(off_set+i_file).name,'_maps.mat');
    out_string = [source_path '/' file_list(off_set+i_file).name(1:end_ind-1)];
    fprintf(p_file,'%s\n',out_string);
end
end
fclose(p_file);



